<script setup lang="ts">

import TextHeader from "@/components/index/article/TextHeader.vue";
import {useRoute} from "vue-router";
import {ref} from "vue";
import {articleDetail, } from "@/http/home";
import router from "@/router";

// 接收传过来的id
const route = useRoute()
const id = route.query.id

// 文章详情请求
const articleInformation = ref<object>({})

articleDetail(id).then(res => {
    console.log(res)
   if (res.code==200){
       articleInformation.value = res.data
   }else if (res.code==401){
       router.push('/denglu')
   }
})

// console.log(articleInformation.value)
// 把文章详情内容传递给子组件

</script>

<template>
    <div>
        <text-header :textInfo="articleInformation"></text-header>
    </div>
</template>

<style scoped lang="less">

</style>